<%# gallery.rhtml $Revision: 2.0.1 $ %>
<%# Copyright (c) 2005-2012 N.KASHIJUKU <n-kashi[at]whi.m-net.ne.jp> %>
<%# You can redistribute it and/or modify it under GPL2. %>

<div class="adminmenu"><%%=navi_user%></div><h1><%= CGI::escapeHTML( @conf.html_title ) %> [Image Gallery]</h1>

<% if @images.length == 0 %>
<p>該当するファイルはありません</p>
	<%= format_links_date %>
<% else %>
<% if @mode == "list" or @mode == "slide" or @mode == "fslide" %>
	<%= format_links_date %>
	<div class="day">
		<% if @images.length != 0 %>
			<h2><span class="date"><%=  _(@conf.to_native(@t_page_title)) %>&nbsp;&nbsp;Page&nbsp;<%=@start / @num + 1 %></span>&nbsp;<span class="nyear">[<%= @image_num %> 枚中 <%= @start + 1 %> - <%= @start + @images.length %> 枚目]&nbsp;&nbsp;<%= get_other_mode_link %></span></h2>
		<% end %>
		<div class="body">
			<div class="section">
			<div class="categorylink"><%= format_link_list_category(@images) %></div>
				<% if @mode == "list" %>
				<table class="imagelist">
					<% @line.times do |line|%>
 						<tr>
						<% @column.times do |column| %>
						<% i = line * @column + column %>
						<td>
						<% if @images[i] != nil %>
							<% if @images[i].width.to_i > @images[i].height.to_i %>
								<p><a href="<%= format_link_viewer_image(@image_hash.index(@images[i])) %>"><img src="<%= @image_url %>/<%= @images[i].url %>" width="<%= @width %>" height="<%= (@width.to_i*@images[i].height.to_i/@images[i].width.to_i).to_s %>" alt="<%= @images[i].file %>" title="<%= @images[i].file %>" class="imagebody"></a></p>
							<% else %>
								<p><a href="<%= format_link_viewer_image(@image_hash.index(@images[i])) %>"><img src="<%= @image_url %>/<%= @images[i].url %>" width="<%= (@width.to_i*@images[i].width.to_i/@images[i].height.to_i).to_s %>" height="<%= @width %>" alt="<%= @images[i].file %>" title="<%= @images[i].file %>" class="imagebody"></a></p>
							<% end %>
							<p class="imagetitle"><%= CGI::escapeHTML(@images[i].title) %></p>
							<p class="imagedate"><a href="./?date=<%= @images[i].date %>"  title="<%= CGI::escapeHTML(@images[i].subtitle) %>"><%= @images[i].date.sub(/(\d{4})(\d{2})(\d{2})/, '\1-\2-\3') %></a></p>
							<% end %>
						</td>
						<% end %>
						</tr>
						<% break if @images[(line + 1) * @column] == nil %>
					<% end %>
				</table>
				<% elsif @mode == "slide" or @mode == "fslide" %>
					<%= js_start_gallery %>
					<div class="content">
					<div id="myGallery">
					<% (@line * @column).times do |i| %>
						<div class="imageElement">
						<h3><%= CGI::escapeHTML(@images[i].title) %>[<%= @images[i].date.sub(/(\d{4})(\d{2})(\d{2})/, '\1-\2-\3') %>]</h3>
						<p><%= CGI::escapeHTML(@images[i].subtitle) %></p>
						<a href="./?date=<%= @images[i].date %>" title="to Diary" class="open"></a>
						<% image_file = @images[i].file.dup %>
						<% if @use_mid_image && @mode == "slide" %>
							<% if image_file[4] == ?/ %>
								<% image_file[4] = "/m" %>
							<% else %>
								<% image_file = "m" + image_file %>
							<% end %>
						<% end %>
						<img src="<%= @image_url %>/<%= image_file %>" class="full" />
						<img src="<%= @image_url %>/<%= @images[i].url %>" class="thumbnail" />
						</div>
						<% break if @images[i+1] == nil %>
					<% end %>
					</div>
				</div>
				<% end %>
			</div>
		</div>
	</div>
	<div class="referer">
	<% if @image_num > 0 %>
		<%= format_links(@image_num) %>
	<% end %>
	</div>

<% elsif @mode == "viewer" %>
	<%= format_links_viewer %>
	<div class="day">
		<h2><span class="date">&nbsp;<a href="./?date=<%= @images[0].date %>" title="<%= CGI::escapeHTML(@images[0].subtitle) %>"><%= @images[0].date.sub(/(\d{4})(\d{2})(\d{2})/, '\1-\2-\3') %></a></span>&nbsp;&nbsp;<span class="title"><%= CGI::escapeHTML(@images[0].title) %></span>&nbsp;&nbsp;<span class="nyear">[<%= @images[0].file %>:<%= @images[0].width %>(w)×<%= @images[0].height %>(h)]</span></h2>
		<div class="body">
			<% image_file = @images[0].file.dup %>
			<% month_filter = ((image_file[4] == ?/) ? %Q[^#{image_file[0,4]}/#{image_file[5,6]}] : %Q[^#{image_file[0,6]}]) %>
			<div class="categorylink">&raquo;<%= format_link_viewer_date(@images[0].date[0,4], "^"+@images[0].date[0,4]) %>-<%= format_link_viewer_date(@images[0].date[4,2], month_filter) %>-<%= format_link_viewer_date(@images[0].date[6,2], @images[0].date[0,8]) %>&nbsp;|&nbsp;<%= format_link_viewer_category(@images[0].subtitle) %></div>
			<div class="section">
				<table class="imageview">
					<tr>
						<td colspan="2">
							<% image_file = @images[0].file.dup %>
							<% if @use_mid_image %>
								<% if image_file[4] == ?/ %>
									<% image_file[4] = "/m" %>
								<% else %>
									<% image_file = "m" + image_file %>
								<% end %>
							<% end %>
							<a href="<%= @image_url %>/<%= @images[0].file %>"><img src="<%= @image_url %>/<%= image_file %>" <%= @sizestr %> alt="<%= CGI::escapeHTML(@images[0].title) %>" title="<%= CGI::escapeHTML(@images[0].title) %>" class="imagebody"></a>
						</td>
					</tr>
					<tr>
						<td>
							<% if @show_exif and @exifstr.length != 0 %>
								<strong><p class="infobar"> - EXIF Data -</p></strong>
								<strong><p class="exiftitle"><%= @exifstr[0] %></p></strong>
								<ul class="exifdata">
								<% i = 1 %>
								<% while i < @exifstr.length %>
									<% if @exifstr.length > 5 and i == @exifstr.length / 2 %>
							</ul>
						</td>
					<td>
							<ul class="exifdata">
									<% end %>
									<% if @exifstr[i][0,2] == "--" %>
							</ul>
							<strong><p class="exiftitle"><%= @exifstr[i] %></p></strong>
							<ul class="exifdata">
									<% else %>
									<li><%= @exifstr[i] %></li>
									<% end %>
										<% i = i + 1 %>
								<% end %>
								</ul>
						</td>
							<% end %>
					</tr>
				</table>
			</div>
		</div>
	</div>
<% end %>
<% end %>

<% if @show_inputfield %>
<form action="<%= @cgi.script_name ? _(@cgi.script_name) : '' %>">
<p>
画像の選択:&nbsp;ファイル名：<input type="text" name="name" value="<%= _(@conf.to_native(@name_filter)) %>" size="16" />
&nbsp;日記のサブタイトル:<input type="text" name="subtitle" value="<%= _(@conf.to_native(@subtitle_filter)) %>" size="16" />
&nbsp;画像のタイトル:<input type="text" name="title" value="<%= _(@conf.to_native(@title_filter)) %>" size="16" />
</p>
<p>
並べ替え:
<select name="order">
<%= @order_options %>
</select>&nbsp;&nbsp;
表示形式:
<select name="mode">
<%= @mode_options %>
</select>
<input type="submit" value="表示" />
</p>
</form>
<div class="footer">
Generated by <a href="http://www1.whi.m-net.ne.jp/n-kashi/image-gallery2.html">tDiary Image Gallery</a> version <%= @img_version %></div>
<% end %>
